package com.roast.util;

import java.util.ArrayList;
import com.roast.domain.*;

public class CopyArrayList {

    public static boolean events(ArrayList<DomainObject> from, ArrayList<Event> to) {
        if (from.isEmpty()) {
            return false;
        }
        for (int i = 0; i < from.size(); i++) {
            Event event;
            try {
                event = (Event) from.get(i);
                to.add(event);
            } catch (Exception e) {
                return false;
            }
        }
        return true;
    }

    public static boolean objects(ArrayList<Object> from, ArrayList<Object> to) {
        if (from.isEmpty()) {
            return false;
        }
        for (int i = 0; i < from.size(); i++) {
            try {
                to.add(from.get(i));
            } catch (Exception e) {
                return false;
            }
        }
        return true;
    }
}
